package pro.common.io;

import pro.common.constant.FileType;

public class FileFactory {
    BaseCmd fileCmd;

    public Object read(FileType fileType, String filName) {
        String baseDic = "";
        if (fileType == FileType.CSV) {
            fileCmd = new CsvCmd(baseDic);
        } else if (fileType == FileType.EXCEL) {
            fileCmd = new ExcelCmd(baseDic);
        } else if (fileType == FileType.XML) {
            fileCmd = new XmlCmd(baseDic);
        } else {
            fileCmd = new TxtCmd(baseDic);
        }

       Object  content = fileCmd.read(filName);

        if (content instanceof String){
            BaseCmd.logger.info(content.toString());
        }
        else {

        }

        return content;
    }
}
